<?php
namespace app\manage\controller;

class SystemCrontab extends Base
{
    public function index(){
        if(request()->isAjax()){
            $page = input('page');
            $limit = input('limit');
            $id = input('id');
            $roleId = input('role_id');

            $where = [];
            !empty($id) && $where['id'] = $id;
            !empty($roleId) && $where['roleid'] = $roleId;

            if( ! $count=model('SystemAdmin')->where($where)->count() ){
                $this->layTable();
            }

            $select = model('SystemAdmin')
                ->where($where)
                ->limit(($page-1)*$limit, $limit)
                ->order('id desc')
                ->select();
            $data = collection($select)->append(['role_name']);

            $this->layTable(0, '管理员列表', $data, $count);
        }else{
            $date1 = date('Y-m', time()).' - '.date('Y-m', time());
            return view('', ['date1'=>$date1]);
        }
    }
}